package com.jumper.property.comparer.formatter;

import com.jumper.property.comparer.core.constant.FormatConstant;

public class PropertyDiffFormatter extends AbstractDiffFormatter {

    private final String propertyName;
    private final String beforeValue;
    private final String afterValue;

    public PropertyDiffFormatter(String propertyName, String beforeValue, String afterValue) {
        this.propertyName = propertyName;
        this.beforeValue = beforeValue;
        this.afterValue = afterValue;
    }

    @Override
    public String format() {
        return pattern.getPropertyDiffPattern()
                .replace(FormatConstant.DISPLAY_PROPERTY_KEY, propertyName)
                .replace(FormatConstant.BEFORE_VALUE_KEY, beforeValue)
                .replace(FormatConstant.AFTER_VALUE_KEY, afterValue);
    }
}
